Implement LWG#2596: 'vector::data() should use addressof' git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@274241 91177308-0d34-0410-b5e6-96231b3b80d8 
diff --git a/test/std/containers/sequences/vector/vector.data/data.pass.cpp b/test/std/containers/sequences/vector/vector.data/data.pass.cpp index 0b58601..f6c0575 100644 --- a/test/std/containers/sequences/vector/vector.data/data.pass.cpp +++ b/test/std/containers/sequences/vector/vector.data/data.pass.cpp 
@@ -17,6 +17,15 @@  #include "min_allocator.h"  #include "asan_testing.h"   +struct Nasty { +	Nasty() : i_(0) {} +	Nasty(int i) : i_(i) {} +	~Nasty() {} + +	Nasty * operator&() const { assert(false); return nullptr; } +	int i_; +	}; +  int main()  {  { @@ -26,7 +35,12 @@  }  {  std::vector<int> v(100); - assert(v.data() == &v.front()); + assert(v.data() == std::addressof(v.front())); + assert(is_contiguous_container_asan_correct(v)); + } + { + std::vector<Nasty> v(100); + assert(v.data() == std::addressof(v.front()));  assert(is_contiguous_container_asan_correct(v));  }  #if TEST_STD_VER >= 11 @@ -37,7 +51,12 @@  }  {  std::vector<int, min_allocator<int>> v(100); - assert(v.data() == &v.front()); + assert(v.data() == std::addressof(v.front())); + assert(is_contiguous_container_asan_correct(v)); + } + { + std::vector<Nasty, min_allocator<Nasty>> v(100); + assert(v.data() == std::addressof(v.front()));  assert(is_contiguous_container_asan_correct(v));  }  #endif 
diff --git a/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp b/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp index ac6ecd1..c97ad29 100644 --- a/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp +++ b/test/std/containers/sequences/vector/vector.data/data_const.pass.cpp 
@@ -17,6 +17,15 @@  #include "min_allocator.h"  #include "asan_testing.h"   +struct Nasty { +	Nasty() : i_(0) {} +	Nasty(int i) : i_(i) {} +	~Nasty() {} + +	Nasty * operator&() const { assert(false); return nullptr; } +	int i_; +	}; +  int main()  {  { @@ -26,7 +35,12 @@  }  {  const std::vector<int> v(100); - assert(v.data() == &v.front()); + assert(v.data() == std::addressof(v.front())); + assert(is_contiguous_container_asan_correct(v)); + } + { + std::vector<Nasty> v(100); + assert(v.data() == std::addressof(v.front()));  assert(is_contiguous_container_asan_correct(v));  }  #if TEST_STD_VER >= 11 @@ -40,5 +54,10 @@  assert(v.data() == &v.front());  assert(is_contiguous_container_asan_correct(v));  } + { + std::vector<Nasty, min_allocator<Nasty>> v(100); + assert(v.data() == std::addressof(v.front())); + assert(is_contiguous_container_asan_correct(v)); + }  #endif  } 
diff --git a/www/cxx1z_status.html b/www/cxx1z_status.html index c121e14..35f237d 100644 --- a/www/cxx1z_status.html +++ b/www/cxx1z_status.html 
@@ -279,7 +279,7 @@ 	<tr><td><a href="http://wg21.link/LWG2551">2551</a></td><td>[fund.ts.v2] "Exception safety" cleanup in library fundamentals required</td><td>Oulu</td><td></td></tr> 	<tr><td><a href="http://wg21.link/LWG2555">2555</a></td><td>[fund.ts.v2] No handling for over-aligned types in optional</td><td>Oulu</td><td></td></tr> 	<tr><td><a href="http://wg21.link/LWG2573">2573</a></td><td>[fund.ts.v2] std::hash&lt;std::experimental::shared_ptr&gt; does not work for arrays</td><td>Oulu</td><td></td></tr> -	<tr><td><a href="http://wg21.link/LWG2596">2596</a></td><td>vector::data() should use addressof</td><td>Oulu</td><td></td></tr> +	<tr><td><a href="http://wg21.link/LWG2596">2596</a></td><td>vector::data() should use addressof</td><td>Oulu</td><td>Complete</td></tr> 	<tr><td><a href="http://wg21.link/LWG2667">2667</a></td><td>path::root_directory() description is confusing</td><td>Oulu</td><td></td></tr> 	<tr><td><a href="http://wg21.link/LWG2669">2669</a></td><td>recursive_directory_iterator effects refers to non-existent functions</td><td>Oulu</td><td></td></tr> 	<tr><td><a href="http://wg21.link/LWG2670">2670</a></td><td>system_complete refers to undefined variable 'base'</td><td>Oulu</td><td></td></tr>